import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'solr/solrFile',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data,
    onUploadProgress: progressEvent => {
      var percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total)
      console.log('percentCompleted:' + percentCompleted)
    }
  })
}

export function del(id) {
  return request({
    url: 'solr/solrFile/' + id,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'solr/solrFile',
    method: 'put',
    data
  })
}

export function fullIndex() {
  return request({
    url: 'solr/reIndex',
    method: 'post'
  })
}

export function deltaIndex() {
  return request({
    url: 'solr/deltaIndex',
    method: 'post'
  })
}
